﻿using Sgr.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Sgr.UPMS.Domain.Menus
{
    /// <summary>
    /// 菜单仓储接口
    /// </summary>
    public interface IMenuRepository : ITreeNodeBaseRepositoryOfTEntityAndTPrimaryKey<Menu, long>
    {
        /// <summary>
        /// 检查同级菜单下是否存在相同名称
        /// </summary>
        /// <param name="name">菜单名称</param>
        /// <param name="parentId">父级菜单ID</param>
        /// <param name="excludeId">需要排除的菜单ID</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>是否存在</returns>
        Task<bool> IsNameExistsInSameLevelAsync(string name,
            long parentId,
            long? excludeId = null,
            CancellationToken cancellationToken = default);

        /// <summary>
        /// 检查路由名称是否唯一
        /// </summary>
        /// <param name="routeName">路由名称</param>
        /// <param name="excludeId">需要排除的菜单ID</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<bool> IsRouteNameExistsAsync(string routeName,
            long? excludeId = null,
            CancellationToken cancellationToken = default);
    }
}